#!/usr/bin/perl -w
########################################################################
# script name:  dbi_query.pm
# Used for:	connect and execute on mysql databases
# Author:       Martin Dumont
# Contributors:
# Version:      0.1
#
# (date format: date +'%Y/%m/%d')
#
# Date          Version Contributors    Modifications
# ----------    ------- ------------    -------------
# 2011/02/23    0.1     MDUMONT         initial
########################################################################
use strict;
use warnings;
use CGI;
use CGI::Pretty;
use CGI::Carp qw(fatalsToBrowser);
#######################################
# MAIN
#######################################
sub userssearchform{
	my $page = new CGI;
   print $page->start_div({-id=>'queryform'});
   print $page->start_form(-method=>"get", -action=>'/cgi-bin/userstable.pl');
   print $page->textfield(-type=>'text', -name=>'query');
   print $page->submit;
   #print $page->submit('Search');
   print $page->end_form;
   print $page->end_div;
}
sub dashboardform{
	my $page = new CGI;
   print $page->start_div({-id=>'queryform'});
   print $page->start_form(-method=>"get", -action=>'/cgi-bin/dashboard.pl');
   print $page->textfield(-type=>'text', -name=>'query');
   print $page->submit('Search');
   print $page->end_form;
   print $page->end_div;
}
sub hostqueryform{
	my $page = new CGI;
   print $page->start_div({-id=>'queryform'});
   print $page->start_form(-method=>"get", -action=>'/cgi-bin/hoststables.pl');
   print $page->textfield(-type=>'text', -name=>'query');
   print $page->submit('Host');
   print $page->end_form;
   print $page->start_form(-method=>"get", -action=>'/cgi-bin/hoststables.pl');
   print $page->submit(-name=>'env_button', -value=>'prd');
   print $page->submit(-name=>'env_button', -value=>'dev');
   print $page->submit(-name=>'env_button', -value=>'qa');
   print $page->submit(-name=>'env_button', -value=>'int');
   print $page->submit(-name=>'env_button', -value=>'sb');
   print $page->submit(-name=>'env_button', -value=>'tr');
   print $page->submit(-name=>'env_button', -value=>'other');
   print $page->submit(-name=>'env_button', -value=>'ALL');
   print $page->end_form;
   print $page->end_div;
}
sub virtualmachines{
	my $page = new CGI;
}
sub build_header{
	my $q = new CGI;
	print $q->header();
	print $q->start_html(-title=>"$_[0]",
               -style=>{'src'=>'/opmgt/styles.css'},
               -base=>'true',
               -meta=>{'keywords'=>'SA Unix', 'copyright'=>'copyright 2011 Vima'},
               -author=>'mdumont@solutionix.ca');
}
sub build_banner{
	my $q = new CGI;
	print $q->start_div({-id=>'banner'});
		print $q->start_a({-href=>'/cgi-bin/homepage.pl'});
			print $q->img({-src=>'/opmgt/images/Logo_Bombardier.gif', -border=>'0'});
		print $q->end_a; 
	print $q->end_div;
}
sub build_menu{
	my $q = new CGI;
	print $q->start_div({-id=>'centeredmenu'});
		print $q->start_ul;
			print $q->start_li;
				print $q->a({-id=>'tab1', -href=>'/cgi-bin/dashboard.pl'}, 'Dashboard');
			print $q->end_li;
			print $q->start_li;
				print $q->a({-id=>'tab2', -href=>'/cgi-bin/hoststables.pl'}, 'Hosts');
			print $q->end_li;
			#print $q->start_li;
			#	print $q->a({-id=>'tab3', -href=>'/crm.html'}, 'Clusters');
			#print $q->end_li;
			#print $q->start_li;
			#	print $q->a({-id=>'tab4', -href=>'/cgi-bin/kvmtables.pl'}, 'Kvm');
			#print $q->end_li;
			#print $q->start_li;
			#	print $q->a({-id=>'tab5', -href=>'/cgi-bin/hoststables.pl'}, 'Backups');
			#print $q->end_li;
			print $q->start_li;
				print $q->a({-id=>'tab6', -href=>'/cgi-bin/userstable.pl'}, 'Users');
			print $q->end_li;
		print $q->end_ul;	
	print $q->end_div;
}
1;
